Open MitchellGerdisch opened 1 year ago
I don't think this issue is specific to Pulumi. I can repro without using anything related to Pulumi.
{
"name": "lodashrepro",
"main": "index.ts",
"devDependencies": {
"@types/node": "^16"
},
"dependencies": {
"@types/lodash": "^4.14.195",
"lodash": "^4.17.21",
"ts-node": "^7.0.1",
"typescript": "~3.8.3"
}
}
{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.ts"
]
}
import { fromPairs, mapValues } from "lodash";
npm install
npx ts-node index.ts
/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/index.ts:261
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
index.ts(1,21): error TS2305: Module '"../../../../../../../Users/justin/Documents/2023/06/30/lodashrepro/node_modules/@types/lodash"' has no exported member 'mapValues'.
at createTSError (/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/index.ts:261:12)
at getOutput (/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/index.ts:367:40)
at Object.compile (/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/index.ts:558:11)
at Module.m._compile (/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Object.require.extensions.<computed> [as .ts] (/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/index.ts:442:12)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
at Object.<anonymous> (/Users/justin/Documents/2023/06/30/lodashrepro/node_modules/ts-node/src/bin.ts:157:12)
modify package.json to pin to previous version: "@types/lodash": "4.14.191"
npm install
npx ts-node index.ts
no error
modify package.json back to: "@types/lodash": "^4.14.195"
npm install
npx ts-node index.ts
still no error
Perhaps ts-node
is doing some caching that isn't invalidated? If I use the latest typescript and ts-node, I don't get the error the first time.
Just ran into this with @types/lodash@4.14.197"
as well
What happened?
I did the following:
pulumi new typescript
npm i lodash
npm i @types/lodash
"@types/lodash": "^4.14.195"
import { fromPairs, mapValues } from "lodash";
pulumi up
orpulumi preview
I received this error:
If I then do the following things will be fine:
"@types/lodash": "4.14.191"
npm i
pulumi preview
will work now without error."@types/lodash": "^4.14.195"
npm i
pulumi preview
will still work now even though it's same package version as at the beginning when it didn't work.Expected Behavior
I shouldn't have to go through this sequence to be able to use the lastest version of the types package.
Steps to reproduce
See above
Output of
pulumi about
CLI
Version 3.73.0 Go Version go1.20.5 Go Compiler gc
Plugins NAME VERSION nodejs unknown
Host
OS darwin Version 13.4.1 Arch x86_64
This project is written in nodejs: executable='/Users/mitch/.nvm/versions/node/v18.0.0/bin/node' version='v18.0.0'
Current Stack: xxxxxx/lodash-test/dev
Found no resources associated with dev
Found no pending operations associated with dev
Backend
Name pulumi.com
Dependencies: NAME VERSION @pulumi/pulumi 3.73.0 @types/lodash 4.14.195 @types/node 16.18.37 lodash 4.17.21
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).